<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>剑灵活动小助手</title>
  <link rel="shortcut icon" href="./favicon.ico">
  <style>
    html,body{
      height: 100%;
      width: 100%;
      margin: 0;
      padding: 0;
      background: url("assets/background.jpg") no-repeat;
      background-size: 100% 100%;
    }
    .container{
      display: flex;
      height: 100%;
      flex-direction: column;
    }
    .header{
      height: 30px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      -webkit-user-select: none;
      background: rgba(0,0,0,.3);
    }
    .title{
      font-size: 12px;
      padding: 0 0 0 10px;
      flex: 1;
      color: #fff;
      -webkit-app-region: drag;
      display: flex;
      align-items: center;
    }
    .title img{
      width: 25px;
      margin: 0 8px 0 0;
    }
    .header-right{
      display: flex;
      align-items: center;
    }
    .mini{
      display: inline-block;
      padding: 0 10px;
      height: 30px;
      font-size: 30px;
      line-height: 26px;
      color: #fff;
    }
    .mini:hover{
      color: #909399;
      cursor: pointer;
    }
    .close{
      display: inline-block;
      font-size: 26px;
      padding: 0 10px;
      height: 30px;
      line-height: 30px;
      color: #fff;
    }
    .close:hover{
      color: #F56C6C;
      cursor: pointer;
    }
    #webview{
      width: 100%;
      height: 100%;
      flex: 1;
      overflow-y: auto;
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="header">
      <div class="title">
        <img src="./favicon.ico" alt="game">
        <span>剑灵活动小助手</span>
      </div>
      <div class="header-right">
        <span class="mini" onclick="handleMini()" title="最小化">-</span>
        <span class="close" onclick="handleClose()" title="退出">&times;</span>
      </div>
    </div>
    <webview id="webview" src="http://127.0.0.1:23333/" nodeintegration enableremotemodule />
  </div>
  <script>
    const win = require('electron').remote.getCurrentWindow()
    const {ipcMain} = require('electron').remote
    function handleMini() {
      win.minimize()
    }
    function handleClose() {
      win.destroy()
    }
    const webview = document.querySelector('#webview')
    ipcMain.on('f12', function() {
      webview.openDevTools()
    })
  </script>
</body>
</html>